from pymongo import MongoClient
##client=MongoClient()
##client = MongoClient('localhost', 27017)
client = MongoClient('mongodb://localhost:20000/')
##db = client.test#获取数据库，数据库名为“test”
db = client['test']

##students = db.student#获取集合（相当于关系型数据库中的表）
students = db['student']
##print(students.find_one())
wl = students.find_one({"name":"wl"})
print(students.find_one({"name":"wl"})['id'])
wjf = {"id":2,"name":"wjf"
    }
wjf_id = students.insert_one(wjf).inserted_id
print("wjf_id:",wjf_id)
lt = {"id":3,"name":"liaotian"}
lt_id = students.insert_one(lt).inserted_id
print("lt_id:",lt_id)

topclass=db['topclass']
print('success')
